/**
  EG4Sim project, Anyang Normal University && IMP-CAS
  \class EG4DetectorConstruct.h
  \brief To construct detectors for G4 sim
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2019-01-21
  \date 2023-11-07 last modified
  \copyright Copyright (c) 2023-2024 IMP-CAS with LGPLv3 LICENSE
*/

#ifndef EG4DetConstruct_h
#define EG4DetConstruct_h

#include <yaml-cpp/yaml.h>
#include "G4VUserDetectorConstruction.hh"

class G4VPhysicalVolume;
class G4Material;
class EG4ParaManager;
class EG4T0;
class EG4T1;
class EG4TA;
class EG4TA0;
class EG4DCTaD;
class EG4Dipo;
class EG4DC;
class EG4DC6;
class EG4TOFW;
class EG4TOFW30;
class EG4NW;

class EG4DetConstruct : public G4VUserDetectorConstruction{
public:
  EG4DetConstruct();
  virtual ~EG4DetConstruct();

  virtual G4VPhysicalVolume *Construct() override;
  virtual void ConstructMaterial(); ///< construct needed material for global use
  virtual void ConstructSDandField() override; ///< sensitive detectors & fields

protected:
  static void readpos(const YAML::Node &f, double *p, double *a);

  G4VPhysicalVolume *fWorld;
  EG4ParaManager *fpm;

  /// those LVs need to be matched with sensitive detectors and fields
  G4LogicalVolume *fWorldLV;
  EG4T0 *fT0;
  EG4T1 *fT1;
  EG4DCTaD *fDCTaD;
  EG4Dipo *fDipo;
  EG4DC *fDC, *fDCm;
  EG4DC6 *fDC6m; // dc6m: the wide DC
  EG4TOFW *fTOFW;
  EG4TOFW30 *fTOFWm;
  EG4NW *fNW;
  EG4TA *fTA; // the reaction target
  EG4TA0 *fTA0; // the primary target

  // constructed materials //
  G4Material *fAir, *fVacuum;
  G4Material *fAr, *fCO2, *fDCGas;
  G4Material *fAl5052, *fFR4;
};

#endif
